package com.bocloud.cmp.dao;

import java.util.List;
import java.util.Map;

import com.bocloud.cmp.entity.resource.Snapshot;
import com.bocloud.common.model.Param;
import com.bocloud.database.core.intf.GenericDao;

/**
 * 快照DAO接口
 * 
 * @author dongkai
 *
 */
public interface SnapshotDao extends GenericDao<Snapshot, Long> {

	/**
	 * 列表展示
	 * 
	 * @param page
	 * @param rows
	 * @param params
	 * @param sorter
	 * @return
	 * @throws Exception
	 */
	public List<Snapshot> list(int page, int rows, List<Param> params, Map<String, String> sorter) throws Exception;

	/**
	 * 查询所有
	 * 
	 * @return
	 * @throws Exception
	 */
	public List<Snapshot> listByVid(Long vendorId) throws Exception;

	/**
	 * 根据虚拟机ID查询
	 * 
	 * @param vmId
	 * @return
	 * @throws Exception
	 */
	public List<Snapshot> listByVMid(Long vmId) throws Exception;

	/**
	 * 根据云硬盘ID查询
	 * 
	 * @param volumeId
	 * @return
	 * @throws Exception
	 */
	public List<Snapshot> listByVloumeId(String volumeId) throws Exception;

	/**
	 * 查询数量
	 * 
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public int count(List<Param> params) throws Exception;

	/**
	 * 删除
	 * 
	 * @param id
	 * @param userId
	 * @return
	 * @throws Exception
	 */
	public boolean remove(Long id, Long userId) throws Exception;

	/**
	 * 根据云供应商ID删除
	 * 
	 * @param vendorId
	 * @param userId
	 * @return
	 * @throws Exception
	 */
	public boolean removeByVid(Long vendorId, Long userId) throws Exception;

	/**
	 * 根据快照ID查询
	 * 
	 * @param snapId
	 * @return
	 * @throws Exception
	 */
	public Snapshot getBySnapId(String snapId) throws Exception;

	/**
	 * 根据ID查询
	 * 
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public Snapshot query(Long id) throws Exception;

	/**
	 * 根据vmId删除快照
	 * 
	 * @param vmId
	 * @param userId
	 * @return
	 */
	public boolean removeByVm(Long vmId, Long userId) throws Exception;

	/**
	 * 数量
	 * 
	 * @param params
	 * @param type
	 * @return
	 * @throws Exception
	 */
	public int count(List<Param> params, String type) throws Exception;

}
